package com.yummy.entity;

import javax.persistence.Id;
import java.io.Serializable;

/**
 * 
 * @TableName account
 */
public class Account implements Serializable {
    /**
     * 账户索引
     */
    @Id
    private Integer accountId;

    /**
     * 账户资金
     */
    private Double capital;

    /**
     * 冻结资金
     */
    private Double frozenCapital;

    private static final long serialVersionUID = 1L;

    /**
     * 账户索引
     */
    public Integer getAccountId() {
        return accountId;
    }

    /**
     * 账户索引
     */
    public void setAccountId(Integer accountId) {
        this.accountId = accountId;
    }

    /**
     * 账户资金
     */
    public Double getCapital() {
        return capital;
    }

    /**
     * 账户资金
     */
    public void setCapital(Double capital) {
        this.capital = capital;
    }

    /**
     * 冻结资金
     */
    public Double getFrozenCapital() {
        return frozenCapital;
    }

    /**
     * 冻结资金
     */
    public void setFrozenCapital(Double frozenCapital) {
        this.frozenCapital = frozenCapital;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Account other = (Account) that;
        return (this.getAccountId() == null ? other.getAccountId() == null : this.getAccountId().equals(other.getAccountId()))
            && (this.getCapital() == null ? other.getCapital() == null : this.getCapital().equals(other.getCapital()))
            && (this.getFrozenCapital() == null ? other.getFrozenCapital() == null : this.getFrozenCapital().equals(other.getFrozenCapital()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getAccountId() == null) ? 0 : getAccountId().hashCode());
        result = prime * result + ((getCapital() == null) ? 0 : getCapital().hashCode());
        result = prime * result + ((getFrozenCapital() == null) ? 0 : getFrozenCapital().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", accountId=").append(accountId);
        sb.append(", capital=").append(capital);
        sb.append(", frozenCapital=").append(frozenCapital);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}